package com.unf.edu.rms.controller.validation;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import com.unf.edu.rms.controller.category.CategoryController;
import com.unf.edu.rms.dao.Category;

public class CategoryValidator implements Validator{

	@Override
	public boolean supports(Class<?> arg0) {
		return CategoryController.class.equals(arg0);
		
	}

	@Override
	public void validate(Object obj, Errors errors) {
		System.out.println("UserLoginValidator.validate()==============");
		Category category = (Category)obj;
		ValidationUtils.rejectIfEmpty(errors, "categoryName", "error.categoryName.required");
		ValidationUtils.rejectIfEmpty(errors, "description", "error.CateDescription.required");
		
	}
}
